/*******************************************************************************
**
** Copyright (c) 2011 - The OWE Team
**
** This file is part of OWE.
**
** OWE is a free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; version
** version 2.1 of the License.
**
** OWE is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with OWE. If not, see <http://www.gnu.org/licenses/>.
**
*******************************************************************************/

#include <owe/authorelement.h>
#include <owe/node.h>
#include <owe/textelement.h>
#include <owe/ustring.h>

OWE_USE_NAMESPACE

/*!
    \class AuthorElement
    \brief Widget author information.

    \ingroup Configuration

    Implementation of the widget author element as specified
    <a href="http://www.w3.org/TR/widgets/#author0">here</a>.
*/

/*!
    \fn UString AuthorElement::href() const

    Returns a <a href="http://www.w3.org/TR/widgets/#href">link</a> to some web
    content related to the widget author.
*/

/*!
    \fn UString AuthorElement::email() const

    Returns the widget author <a href="http://www.w3.org/TR/widgets/#email">
    email</a>.
*/

/*!
    Constructs a new AuthorElement from a given \a node.
*/
AuthorElement::AuthorElement(const Node *node)
    : Element(node, Element::Author)
    , m_href(node->attribute("href"))
    , m_email(node->attribute("email"))
{
}

/*!
    Destructs the object releasing all allocated resources.
*/
AuthorElement::~AuthorElement()
{
}

bool AuthorElement::addChild(Element *element)
{
    if (element->type() == Element::Text)
        return addText(static_cast<TextElement *>(element));

    return Element::addChild(element);
}
